<?php

namespace App\Http\Requests\Api\V1;

use Illuminate\Validation\Rule;

use App\Models\Order;

class OrderRequest extends FormRequest
{
    public function rules()
    {
        return [
            'address_id'    => [
                'required',
                Rule::exists('user_addresses', 'id')->where('user_id', $this->user()->id),
            ],
            'order_time'    => [
                'required',
                Rule::in(array_keys(Order::$orderTimeMap)),
            ],
            'message'       => [
                'string',
            ],
        ];
    }
}
